<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/reset.css">
    <script src="./js/jquery.js"></script>
    <style>
        /* css实现下拉框 */
        .content {
            height: 400px;
            /* border:solid red 1px; */
        }

        #nav,
        #nav ul {
            height: 27px;
        }

        li {
            float: left;
            width: 80px;
            position: relative;
        }

        li ul {
            display: none;
            /* visibility: hidden; */
            position: absolute;
        }

        /* li:hover ul {
            display: block;
        } */

        ul li a {
            display: block;
            font-size: 14px;
            text-align: center;
            border: solid 1px #ccc;
            padding: 3px;
            background: #ddd;
        }

        li a:hover {
            background: #eee;
            color: red;
        }
    </style>
</head>

<body>
    <ul id="nav">
        <li>
            <a href="#">微博</a>
            <ul>
                <li><a href="#">私信</a></li>
                <li><a href="#">评论</a></li>
                <li><a href="#">@我</a></li>
            </ul>
        </li>
        <li>
            <a href="#">博客</a>
            <ul>
                <li><a href="#">博客评论</a></li>
                <li><a href="#">未读提醒</a></li>
            </ul>
        </li>
    </ul>
    <div class="content">
        主体内容
    </div>
    <!-- js实现下拉框 -->
    <!-- <script>
        var nav = document.querySelector('#nav')
        var lis = nav.children
        for (let i = 0; i < lis.length; i++) {
            lis[i].onmouseover = function(){
                this.children[1].style.display = 'block'
            }
            lis[i].onmouseleave = function(){
                this.children[1].style.display = 'none'
            }
        }
    </script> -->
    <script>
        $(function () {
            $('#nav>li').mouseover(function () {
                $(this).children('ul').show()
            })
            $('#nav>li').mouseout(function () {
                $(this).children('ul').hide()
            })
        })
    </script>
</body>

</html>